package com.example.moviecms2.utils;

import com.example.moviecms2.vo.ResultVo;

public class ResultVOUtils {
    public static <T>ResultVo<T> success(T data) {
          ResultVo<T> vo = new ResultVo<>();
          vo.setCode(200);
          vo.setMsg("success");
          vo.setData(data);
          return vo;
    }
//重载success方法
    public static <T>ResultVo<T> success() {
        ResultVo<T> vo = new ResultVo<>();
        vo.setCode(200);
        vo.setMsg("success");
        vo.setData(null);
        return vo;
    }
    public static <T>ResultVo<T> fail(){
        ResultVo<T> vo = new ResultVo<>();
        vo.setCode(500);
        vo.setMsg("未知错误");
        vo.setData(null);
        return vo;
    }
//重载fail方法
    public static <T>ResultVo<T> fail(Integer code,String msg,T data){
        ResultVo<T> vo = new ResultVo<>();
        vo.setCode(code);
        vo.setMsg(msg);
        vo.setData(data);
        return vo;
    }
}
